<%-- 
    Document   : archives_by_type_sidebar
    Created on : 10 Jun, 2012, 12:51:26 AM
    Author     : bharat
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="java.sql.*" %>

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link rel="stylesheet" type="text/css" href="./css/maincss.css">
        <link rel="stylesheet" type="text/css" href="./css/myaccountcss.css">
        <title>JSP Page</title>
    </head>
    <body>
        <div class="container">
            <div class="header">
                ONLINE COLLEGE MAGAZINE
            </div>
            <div class="navigation_menu">
                <%@include file="navigationmenu.jsp"%>
            </div>

            <div class="slab">
                <%@include file="home_posts_by_type.jsp"%>
            </div>

            <div class="login">
                <%@include file="types_anchored.html" %>
            </div>
            <div class="sidebar">
                <%
                    String type_ = request.getParameter("type");
                    out.println(type_);


                    Connection con3 = null;
                    PreparedStatement pstmt3 = null;
                    ResultSet rs3 = null;

                    try {

                        Class.forName("oracle.jdbc.driver.OracleDriver");
                        con3 = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe", "aksh", "aksh");

                        pstmt3 = con3.prepareStatement("select type, pid, subject from posts where type=? order by dop desc");
                        pstmt3.setString(1, type_);
                        rs3 = pstmt3.executeQuery();
                %>
                <table>
                    <%
                        while (rs3.next()) {
                    %>                                      
                    <tr><td>
                            <a href="display_post_by_type_when_clicked.jsp?pid=<%=rs3.getString(2)%>&type=<%=rs3.getString(1)%>"><%=rs3.getString(3)%></a>
                        </td></tr>
                        <%
                            }
                        %>
                </table>
                <%

                    } catch (Exception e) {
                        response.sendError(505, e.getMessage());
                        e.printStackTrace();
                    }

                %>
            </div>
            <div class="footer">
                FOOTER
            </div>
        </div>
    </body>
</html>